<fieldset class="box box-solid module aligned {{ fieldset.classes }}">
    {% if fieldset.name %}
        <div class="box-header with-border">
            <div class="box-title">
                {{ fieldset.name }}
                {% if fieldset.description %}
                    <span class="description">{{ fieldset.description|safe }}</span>
                {% endif %}
            </div>
        </div>
    {% endif %}

    <div {% if fieldset.name %}class="box-body"{% endif %}>
        {% for line in fieldset %}
            {% if line.fields|length_is:'1' %}
                {% for field in line %}
                    <div class="form-group row{% if line.errors %} has-error{% endif %}{% if not line.has_visible_field %} hidden{% endif %}{% for field in line %}{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% endfor %}">
                        <label class="col-md-2 control-label text-right">
                            {{ field.field.label }}
                        </label>
                        <div class="col-md-8 {% if field.field.name %} field-{{ field.field.name }}{% endif %}{% if not field.is_readonly and field.errors %} has-error{% endif %}{% if field.field.is_hidden %} hidden{% endif %}">
                            {% if field.is_readonly %}
                                <div class="readonly" style="margin-top: 7px;">{{ field.contents }}</div>
                            {% else %}
                                {{ field.field }}
                                {% if line.errors %}
                                    <label class="control-label" for="inputError"><i
                                            class="fa fa-times-circle-o"></i>{{ line.errors }}</label>
                                {% endif %}
                            {% endif %}
                            {% if field.field.help_text %}
                                <div class="help-block">{{ field.field.help_text|safe }}</div>
                            {% endif %}
                        </div>
                        <div class="col-md-2"></div>
                    </div>
                {% endfor %}
            {% else %}
                <div class="row">
                    <div class="col-lg-9 col-lg-offset-1" style="padding: 0">
                        {% for field in line %}
                            <div class="form-group col-lg-4 col-md-6{% if field.field.errors %} has-error{% endif %}{% if not line.has_visible_field %} hidden{% endif %}{% for field in line %}{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% endfor %}" style="padding: 0">
                                <label class="col-md-4 control-label text-right">{{ field.field.label }}</label>
                                <div class="col-md-8">
                                    {% if field.is_readonly %}
                                        <div class="readonly" style="margin-top: 7px;">{{ field.contents }}</div>
                                    {% else %}
                                        {{ field.field }}
                                        {% if field.field.errors %}
                                            <label class="control-label" for="inputError"><i
                                                    class="fa fa-times-circle-o"></i>{{ field.field.errors }}</label>
                                        {% endif %}
                                    {% endif %}
                                    {% if field.field.help_text %}
                                        <div class="help-block">{{ field.field.help_text|safe }}</div>
                                    {% endif %}
                                </div>
                            </div>
                        {% endfor %}
                    </div>
                </div>
            {% endif %}
        {% endfor %}
    </div>
</fieldset>